from io import BytesIO
f = BytesIO()
f.write('请把我转成二进制数据'.encode('utf-8'))

print(f.getvalue())
